package com.ch.design.kingdom;

/**
 * 双重锁
 *
 * @author CH
 * @date 2022/2/22
 */
public class King04 {
    private static volatile King04 king = null;
    private String name = "国王";
    private King04() {
    }

    public static King04 getKing() {
        if (king == null) {
            synchronized (King04.class) {
                if (king == null) {
                    king = new King04();
                }
            }
        }
        return king;
    }
}
